import VueRouter from "vue-router";
import HmLogin from "@/pages/HmLogin.vue";
import Vue from "vue";
import HmRegister from "@/pages/HmRegister.vue";
import HmLayout from "@/pages/HmLayout.vue";
import HmArticle from "@/views/HmArticle.vue";
import HmLike from "@/views/HmLike.vue";
import HmCollect from "@/views/HmCollect.vue";
import HmMy from "@/views/HmMy.vue";
import HmDetail from "@/pages/HmDetail.vue";

Vue.use(VueRouter);
const router = new VueRouter({
  routes: [
    {
      path: "/layout",
      component: HmLayout,
      redirect: "/article",
      children: [
        {
          path: "/article",
          component: HmArticle,
        },
        { path: "/like", component: HmLike },
        { path: "/collect", component: HmCollect },
        { path: "/user", component: HmMy },
      ],
    },
    {
      path: "/login",
      component: HmLogin,
    },
    {
      path: "/register",
      component: HmRegister,
    },
    {
      path: "/article:id",
      component: HmArticle,
    },
    { path: "/", redirect: "/login" },
    {
      path: "/detail/:id?",
      component: HmDetail,
    },
  ],
  linkActiveClass: "selected",
  linkExactActiveClass: "ex-selected",
});

export default router;
